package com.overseasShopping.Action;


import java.util.Map;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import com.overseasShopping.Biz.GoodsBiz;
import com.overseasShopping.pojo.Goods;

public class GoodDetailAction extends ActionSupport{

	private GoodsBiz goodsBiz;
	private String goodId;
 
	public String getGoodId() {
		return goodId;
	}

	public void setGoodId(String goodId) {
		this.goodId = goodId;
	}

	public GoodsBiz getGoodsBiz() {
		return goodsBiz;
	}

	public void setGoodsBiz(GoodsBiz goodsBiz) {
		this.goodsBiz = goodsBiz;
	}

	public String execute() throws Exception {
		Goods good = goodsBiz.getGoodBygoodId(goodId);// 1.电子产品 2.服装服饰 3.美妆饰品 4.食品饮料
											          // 5.婴幼用品 6.文学著作
		int type = good.getType();

		String style = null;
		if (type == 1) {
			style = "电子产品";
		} else if (type == 2) {
			style = "服装服饰";
		} else if (type == 3) {
			style = "美妆饰品";
		} else if (type == 4) {
			style = "食品饮料";
		} else if (type == 5) {
			style = "婴幼用品";
		} else if (type == 6) {
			style = "文学著作";
		}
		
		Map<String, Object> session = ActionContext.getContext().getSession();
		session.put("good", good);
		session.put("style", style);
		session.put("bb", "bb");
		
		if("buy".equals(good.getListType())){
			return "buy";
		}else{
			return "sale";
		}
	}
}
